/*
 * @Descripttion: 异步中间件————redux-promise
 * @Author: lukasavage
 * @Date: 2021-11-28 11:23:24
 * @LastEditors: lukasavage
 * @LastEditTime: 2021-11-28 11:25:31
 */

function promise({ getState, dispatch }) {
    return function (next) {
        return function (action) {
            if(action.then && typeof action.then === 'function') {
                return action.then(dispatch);
            }
            return next(action);
        }
    }
}

export default promise;